package org.example.app.service.util;

public class CodeUtil {
    // 给出6位验证码的生成代码
    // 要求包含大小写字母 和 数字
    public static String generateCode() {
        String code = "";
        for (int i = 0; i < 6; i++) {
            int type = (int) (Math.random() * 3);
            switch (type) {
                case 0:
                    code += (char) (Math.random() * 26 + 'a');
                    break;
                case 1:
                    code += (char) (Math.random() * 26 + 'A');
                    break;
                case 2:
                    code += (int) (Math.random()* 10);
            }
        }
        return code;
    }
}
